namespace BoxPlayer
{
};

#ifndef T_BOX_BAR_H
#define T_BOX_BAR_H

#include "stable.h"
#include "t_box.h"
#include "t_box_seek_manager.h"

namespace BoxPlayer
{
    class T_VideoProgressBar : public QProgressBar
    {
        Q_OBJECT
    public:
        explicit T_VideoProgressBar(T_Box_Seek_Manager *a_seek_manager, QWidget *parent = 0)
            : QProgressBar(parent)
            , m_seek_manager(a_seek_manager)
            , m_old_x(-1)
        {
        }
    public:
        virtual QString text() const;
        void setElapsed(int a_msec);

    protected:
        virtual bool event(QEvent *e);
        int p_calc_seek_timing(QMouseEvent *v_me);
        void p_handle_seek_click(QMouseEvent *v_me);

    protected:
        T_Box_Seek_Manager *m_seek_manager;
        T_AutoRunClock m_move_sw;
        int m_old_x;
    signals:
        void clicked(int value);
    };

    class T_BufferProgressBar : public QProgressBar
    {
        Q_OBJECT
    public:
        explicit T_BufferProgressBar(QWidget *parent = 0)
            : QProgressBar(parent)
            , m_buffering(false)
        {
        }
    public:
        virtual QString text() const
        {
            if(m_buffering)
            {
                return "Buffering..." + QProgressBar::text();
            }
            return QProgressBar::text();
        }
        void buffering(bool b)
        {
            m_buffering = b;
        }
        bool buffering()
        {
            return m_buffering;
        }
    protected:
        bool m_buffering;
    };

};
#endif // T_BOX_BAR_H
